from app.extensions import db
from app.modules.common.utils import JsonEncoder


class LoadLevel(db.Model, JsonEncoder):
    __tablename__ = "load_level"
    id = db.Column(db.Integer, primary_key = True)
    level_name = db.Column(db.String, nullable = False)
    cpus = db.Column(db.String)
    ram = db.Column(db.String)
    disks = db.Column(db.String)
    desc = db.Column(db.String)
    scale = db.Column(db.String)

    def __init__(self, level_name, cpus, ram, disks,desc,scale):
        self.level_name = level_name
        self.cpus = cpus
        self.ram = ram
        self.disks = disks
        self.desc = desc
        self.scale = scale

    def to_dict(self):
        return {
            'id': self.id,
            'level_name': self.level_name,
            'cpus': self.cpus,
            'ram': self.ram,
            'disks': self.disks,
            'desc': self.desc,
            'scale': self.scale,
        }
